<?php if (!defined('SERVER_ROOT')) exit('No direct script access allowed');

class canbo_Controller extends Controller {
    function __construct(){
        parent::__construct('timkiemthongke', 'canbo');
        $this->check_login();
        $this->view->template->menu_html =$this->CREATE_MENU();
        $this->view->template->nhacviec_html =$this->CREATE_NHAC_VIEC();
        $this->CHECK_QUYEN('timkiemthongke', 'canbo');
    }
    function main(){
        $this->dsp_all_canbo();
    }
    /****************************form canbo***********************/
    private function _save_filter_canbo(){
        $v_MA_SO_CAN_BO= $this->get_post_var('txt_MA_SO_CAN_BO');
        $v_TEN_CAN_BO= $this->get_post_var('txt_TEN_CAN_BO');
        $v_CMND= $this->get_post_var('txt_CMND');
        $v_GIOI_TINH= $this->get_post_var('cbx_GIOI_TINH');
        $v_DC_THUONG_TRU= $this->get_post_var('txt_DC_THUONG_TRU');
        $v_DC_LIEN_LAC= $this->get_post_var('txt_DC_LIEN_LAC');
        $v_DT_CO_DINH= $this->get_post_var('txt_DT_CO_DINH');
        $v_DT_DI_DONG= $this->get_post_var('txt_DT_DI_DONG');
        $v_MA_DAN_TOC= $this->get_post_var('cbx_MA_DAN_TOC');
        $v_MA_TON_GIAO= $this->get_post_var('cbx_MA_TON_GIAO');
        $v_MA_HOC_HAM= $this->get_post_var('cbx_MA_HOC_HAM');
        $v_MA_HOC_VI= $this->get_post_var('cbx_MA_HOC_VI');
        $v_NGAY_VAO_DOAN= $this->get_post_var('txt_NGAY_VAO_DOAN');
        $v_NGAY_VAO_DANG= $this->get_post_var('txt_NGAY_VAO_DANG');
        $v_NGAY_KY_HD= $this->get_post_var('txt_NGAY_KY_HD');
        $v_NGAY_KET_THUC_HD= $this->get_post_var('txt_NGAY_KET_THUC_HD');

        if($v_GIOI_TINH == ''){
           $v_GIOI_TINH = -1;
        }

        return array(
            'txt_MA_SO_CAN_BO'   => $v_MA_SO_CAN_BO,
            'txt_TEN_CAN_BO'=> $v_TEN_CAN_BO,
            'txt_CMND'=> $v_CMND,
            'cbx_GIOI_TINH'=> $v_GIOI_TINH,
            'txt_DC_THUONG_TRU'=> $v_DC_THUONG_TRU,
            'txt_DC_LIEN_LAC'=> $v_DC_LIEN_LAC,
            'txt_DT_CO_DINH'=> $v_DT_CO_DINH,
            'txt_DT_DI_DONG'=> $v_DT_DI_DONG,
            'cbx_MA_DAN_TOC'=> $v_MA_DAN_TOC,
            'cbx_MA_TON_GIAO'=> $v_MA_TON_GIAO,
            'cbx_MA_HOC_HAM'=> $v_MA_HOC_HAM,
            'cbx_MA_HOC_VI'=> $v_MA_HOC_VI,
            'txt_NGAY_VAO_DOAN'=> $v_NGAY_VAO_DOAN,
            'txt_NGAY_VAO_DANG'=> $v_NGAY_VAO_DANG,
            'txt_NGAY_KY_HD'=> $v_NGAY_KY_HD,
            'txt_NGAY_KET_THUC_HD'=> $v_NGAY_KET_THUC_HD,
        );
    }
    function dsp_all_canbo(){
        $arr_filter = $this->_save_filter_canbo();
        $VIEW_DATA['arr_filter'] = $arr_filter;
        $VIEW_DATA['arr_all_dantoc'] = $this->model->SELECT_DANTOC_tatca();
        $VIEW_DATA['arr_all_tongiao'] = $this->model->SELECT_TONGIAO_tatca();
        $VIEW_DATA['arr_all_quoctich'] = $this->model->SELECT_QUOCTICH_tatca();
        $VIEW_DATA['arr_all_hocham'] = $this->model->SELECT_HOCHAM_tatca();
        $VIEW_DATA['arr_all_hocvi'] = $this->model->SELECT_HOCVI_tatca();
        $VIEW_DATA['arr_all_canbo'] = $this->model->TRA_CUU_CAN_BO($arr_filter);
        $this->view->render('dsp_all_canbo',$VIEW_DATA);
    }
}
